package com.ruoyi.common.pms.dao;

import com.ruoyi.common.pms.entity.YytPmsSkuImages;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * sku图片 Mapper 接口
 * </p>
 *
 * @author huangshun
 * @since 2021-12-16
 */
@Repository
public interface YytPmsSkuImagesMapper extends BaseMapper<YytPmsSkuImages> {

    /**
     * 根据skuId获取图片列表
     */
    @Select("select * from yyt_pms_sku_images where sku_id = #{skuId} order by default_img desc")
    List<YytPmsSkuImages> getImages(@Param("skuId") String skuId);

    /**
     * 根据skuId获取图片url地址
     */
    @Select("select img_url from yyt_pms_sku_images where sku_id = #{skuId} order by default_img desc limit 0,1")
    String getImageUrl(@Param("skuId") String skuId);

}
